home *** CD-ROM | disk | FTP | other *** search
/ ASME's Mechanical Engine…ing Toolkit 1997 December / ASME's Mechanical Engineering Toolkit 1997 December.iso / cad_elec / gerbtool.exe / DATA.1 / PS.INI < prev    next >
Text File  |  1996-04-11  |  7KB  |  284 lines

  1. %!PS
  2. %----- Define RECTANGLE procedure 
  3. %lx ly ux uy fill_flag rt
  4. /rt { gsave newpath 
  5. /flag exch def
  6. /uy exch def
  7. /ux exch def
  8. /ly exch def
  9. /lx exch def
  10. lx ly moveto
  11. ux ly lineto
  12. ux uy lineto
  13. lx uy lineto
  14. lx ly lineto
  15. 1 setlinewidth closepath
  16. flag 1 eq {fill} if stroke grestore } def
  17. %----- Define POLYGON procedure 
  18. %[xn yn ... x1 y1] fill_flag pl
  19. /pl {gsave newpath
  20. /flag exch def
  21. /polyarray exch def
  22. /pcount polyarray length 2 idiv 1 sub def
  23. polyarray aload pop moveto 
  24. pcount {lineto} repeat
  25. 1 setlinewidth closepath flag 1 eq {fill} if stroke grestore
  26. } def
  27. %----- Define DONUT procedure 
  28. %iradius oradius ypos xpos dn
  29. /dn { gsave newpath
  30. /xpos exch def
  31. /ypos exch def
  32. /oradius exch def
  33. /iradius exch def
  34. /radius oradius iradius add 2 idiv def
  35. xpos ypos radius 0 360 arc
  36. oradius iradius sub setlinewidth closepath stroke grestore
  37. } def
  38. %----- Define ARC procedure 
  39. %xpos ypos radius theta1 theta2 linewidth ac
  40. /ac { gsave newpath
  41. /linewidth exch def
  42. arc linewidth setlinewidth 1 setlinecap
  43. stroke grestore 
  44. } def
  45. %----- Define CIRCLE procedure 
  46. %xpos ypos radius fill_flag ci
  47. /ci { gsave newpath
  48. /flag exch def
  49. 0 360 arc 1 setlinewidth closepath
  50. flag 1 eq {fill} if stroke grestore 
  51. } def
  52. %----- Define LINETOSKECTH procedure 
  53. %x2 y2 x1 y1 lts
  54. /lts { gsave newpath
  55. moveto lineto
  56. closepath 1 setlinewidth stroke grestore 
  57. } def
  58. %----- Define LINETO procedure 
  59. %x2 y2 x1 y1 linecap linewidth ltd
  60. /ltd { gsave newpath
  61. /linewidth exch def
  62. /linecap exch def
  63. moveto lineto linewidth setlinewidth linecap setlinecap
  64. stroke grestore 
  65. } def
  66. %----- Define MOVETO procedure 
  67. %xpos ypos mv
  68. /mv { moveto } def
  69. %----- Define THERMAL (One Quandrant) procedure 
  70. %x1, y1 x2 y2 theta2 phi2 theta1 phi1 cutsize oradius iradius
  71. % ypos xpos linewidth fill_flag th
  72. /th { gsave 
  73. /fillflag exch def
  74. /rotflag exch def
  75. /linewidth exch def
  76. /xpos exch def
  77. /ypos exch def
  78. /iradius exch def
  79. /oradius exch def
  80. /cutsize exch def
  81. /ph1 exch def
  82. /the1 exch def
  83. /ph2 exch def
  84. /the2 exch def
  85. /y2 exch def
  86. /x2 exch def
  87. /y1 exch def
  88. /x1 exch def
  89. rotflag 1 eq {
  90.     currentpoint
  91.    xpos ypos translate 
  92.     /x1 x1 xpos sub def
  93.     /x2 x2 xpos sub def
  94.     /y1 y1 ypos sub def
  95.     /y2 y2 ypos sub def
  96.     /xpos 0 def
  97.     /ypos 0 def
  98.     45 rotate
  99. }if
  100. newpath
  101. xpos ypos oradius ph2 the2 arc
  102. x1 y1 lineto
  103. xpos ypos iradius the1 ph1 arcn
  104. x2 y2 lineto
  105. rotflag 1 eq {
  106.    -45 rotate
  107.     translate
  108. } if
  109. linewidth setlinewidth fillflag 1 eq {fill} if stroke grestore
  110. } def
  111. %----- Define THERMAL SKETCH procedure 
  112. %theta2 phi2 radius ypos xpos ths
  113. /ths {
  114. /rotflag exch def
  115. /xpos exch def
  116. /ypos exch def
  117. /radius exch def
  118. /phi2 exch def
  119. /theta2 exch def
  120. theta2 phi2 radius ypos xpos 0 rotflag tha
  121. theta2 90 add phi2 90 add radius ypos xpos 0 rotflag tha
  122. theta2 180 add phi2 180 add radius ypos xpos 0 rotflag tha
  123. theta2 270 add phi2 270 add radius ypos xpos 0 rotflag tha
  124. } def
  125. %----- Define THERMAL ARC procedure 
  126. %theta2 phi2 radius yp xp linewidth rotflag tha
  127. /tha { gsave
  128. /rotflag exch def
  129. /linewidth exch def
  130. /xp exch def
  131. /yp exch def
  132. /radius exch def
  133. /phi2 exch def
  134. /theta2 exch def
  135. rotflag 1 eq {
  136.     currentpoint
  137.    xp yp translate 
  138.     /xp 0 def
  139.     /yp 0 def
  140.     45 rotate
  141. }if
  142. newpath
  143. xp yp radius phi2 theta2 arc
  144. rotflag 1 eq {
  145.    -45 rotate
  146.     translate
  147. } if
  148. linewidth setlinewidth stroke grestore 
  149. } def
  150. %----- Define THERMAL OUTLINE procedure 
  151. %theta2 phi2 theta1 phi1 cutsize oradius iradius
  152. % ypos xpos fill_flag tho
  153. /tho {
  154. /fillflag exch def
  155. /rotflag exch def
  156. /x exch def
  157. /y exch def
  158. /irad exch def
  159. /orad exch def
  160. /cuts exch def
  161. /phii1 exch def
  162. /th1 exch def
  163. /phii2 exch def
  164. /th2 exch def
  165.  x cuts add y irad add x orad add y cuts add
  166.  th2 phii2 th1 phii1 cuts orad irad
  167.  y x 0 rotflag fillflag th
  168.  x irad sub y cuts add x cuts sub y orad add
  169.  90 th2 add 90 phii2 add 90 th1 add 90 phii1 add
  170.  cuts orad irad y x 0 rotflag fillflag th
  171.  x cuts sub y irad sub x orad sub y cuts sub
  172.  180 th2 add 180 phii2 add 180 th1 add 180 phii1 add
  173.  cuts orad irad y x 0 rotflag fillflag th
  174.  x irad add y cuts sub x cuts add y orad sub
  175.  270 th2 add 270 phii2 add 270 th1 add 270 phii1 add
  176.  cuts orad irad y x 0 rotflag fillflag th
  177. } def
  178. %----- Define OBLONG procedure 
  179. %ang1 ang2 x4 y4 x3 y3 x2 y2 x1 y1 xdst ydst xsrc ysrc
  180. %wide fill_flag ob
  181. /ob { gsave newpath
  182. /flag exch def
  183. /wide exch def
  184. /ysrc exch def
  185. /xsrc exch def
  186. /ydst exch def
  187. /xdst exch def
  188. /y1 exch def
  189. /x1 exch def
  190. /y2 exch def
  191. /x2 exch def
  192. /y3 exch def
  193. /x3 exch def
  194. /y4 exch def
  195. /x4 exch def
  196. /ang2 exch def
  197. /ang1 exch def
  198. x2 y2 x1 y1 moveto lineto
  199. xdst ydst wide 2 div ang1 ang2 arc
  200. x4 y4 lineto
  201. xsrc ysrc wide 2 div ang2 ang1 arc
  202. 1 setlinewidth flag 1 eq {fill} if stroke grestore
  203. } def
  204.  
  205. /charheight { gsave newpath
  206.     0 0 moveto
  207.     false charpath
  208.     flattenpath
  209.     pathbbox                            % stack = lx ly ux uy
  210.     exch pop                            % stack = lx ly uy
  211.     3 -1 roll pop                    % stack = ly uy
  212.     grestore
  213. }def
  214.  
  215. /stringheight {
  216. /lly 0.0 def
  217. /ury 0.0 def
  218.    {
  219.        ( ) dup 0 4 -1 roll put % create 1 char string
  220.        charheight              % measure its height
  221.         dup ury gt {             % if uy > height max
  222.            /ury exch def         % update
  223.         } {
  224.            pop                  % else discard
  225.         } ifelse
  226.         dup lly lt {             % if ly < height max
  227.            /lly exch def         % update
  228.         } {
  229.            pop                  % else discard
  230.         } ifelse
  231.  
  232.     } forall
  233.     ury lly sub
  234. }def
  235.  
  236. /doClip {
  237. /x xpage xoff sub def
  238. /y ypage yoff sub def
  239. x neg y neg moveto
  240. x y neg lineto
  241. x y lineto
  242. x neg y lineto
  243. closepath clip newpath
  244. }def
  245.  
  246. /doBorder {
  247. initclip
  248. /bordertext exch def
  249. /x xpage xoff sub def
  250. /y ypage yoff sub def
  251. x neg y neg moveto
  252. x y neg lineto
  253. x y lineto
  254. x neg y lineto
  255. x neg y neg lineto 1 setlinewidth stroke
  256. 0 y neg moveto currentpoint % center of bottom line
  257. bordertext
  258. /textHgt bordertext stringheight def
  259. /textWdt bordertext stringwidth pop  def
  260. textWdt 2 div 
  261. 4 -1 roll exch sub
  262. 3 -1 roll textHgt 4 add sub moveto
  263. currentpoint
  264. 1.0 setgray % clear a box for the text
  265. 0 textHgt rlineto
  266. textWdt 0 rlineto
  267. 0 textHgt neg rlineto
  268. closepath fill
  269. 0.0 setgray
  270. moveto
  271. show
  272. } def
  273.  
  274. /fontSize 12.0 def % font size in points
  275. /fontSize fontSize 13.88888 mul def % compensate for scaling
  276. /BorderFont
  277.    /Helvetica findfont fontSize scalefont def
  278. BorderFont setfont
  279. /xoff 0 def % amount to indent border in the x dimension in thousanths
  280. /yoff 200 def % amount to indent border in the y dimension in thousanths
  281. /xtrans 250 def % amount to offset image in the x dimension in thousanths
  282. /ytrans 250 def % amount to offset image in the y dimension in thousanths
  283. % END OF PS.INI
  284.